import request from '../utils/request'

/**
 * 发送注册验证码
 */
export function sendRegisterCode(email) {
  return request({
    url: '/email/send-register-code',
    method: 'post',
    data: { email }
  })
}

/**
 * 发送登录验证码
 */
export function sendLoginCode(email) {
  return request({
    url: '/email/send-login-code',
    method: 'post',
    data: { email }
  })
}

/**
 * 验证注册验证码
 */
export function verifyRegisterCode(email, code) {
  return request({
    url: '/email/verify-register-code',
    method: 'post',
    data: { email, code }
  })
}

/**
 * 验证登录验证码
 */
export function verifyLoginCode(email, code) {
  return request({
    url: '/email/verify-login-code',
    method: 'post',
    data: { email, code }
  })
}

/**
 * 检查邮箱是否已注册
 */
export function checkEmail(email) {
  return request({
    url: `/email/check-email/${email}`,
    method: 'get'
  })
}

/**
 * 获取邮箱功能配置状态（公开API）
 */
export function getEmailConfigStatus() {
  return request({
    url: '/email/config/status',
    method: 'get'
  })
}
